using System;
using System.BusinessObjects.Transactions;
using Blazing.BusinessObjects.Tagging;
using NHibernate;
using NHibernate.Criterion;

namespace Blazing.BusinessObjects.eCommerce.Queries
{
    public class QrySearchTaxonomyTagsByTaxonomyAttachedToProducts
    {
        public static IQuery Query(int taxonomyID)
        {
            string hql = "select distinct t from Product p join p.TaxonomyTags t where t.Taxonomy.ID=:taxonomyId";
            IQuery qry = UnitOfWork.CurrentSession.CreateQuery(hql);
            qry.SetParameter("taxonomyId", taxonomyID);
            return qry; 
        }
    }
}
